package com.ybkj.chat.module.dynamic.activity;

import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.ybkj.chat.R;
import com.ybkj.chat.base.BaseMvpActivity;
import com.ybkj.chat.ui.dialog.PpwSelectPicture;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 编辑群资料 9.7
 */

public class EditGroupActivity extends BaseMvpActivity {
    @BindView(R.id.title)
    TextView title;
    @BindView(R.id.add_photo)
    ImageView addPhoto;
    @BindView(R.id.ll_rootview)
    LinearLayout llRootview;

    private PpwSelectPicture mPpwSelectPicture;


    @Override
    protected void injectPresenter() {

    }

    @Override
    protected void initTitle() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_edit_group;
    }

    @Override
    protected void initView() {
        initPictureSelectPop();

    }

    @Override
    protected void initData() {

    }


    @OnClick({R.id.title, R.id.add_photo})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.title:
                break;
            case R.id.add_photo:
                mPpwSelectPicture.showAtLocation(llRootview, Gravity.BOTTOM, 0, 0);
                mPpwSelectPicture.setBackgroundAlpha(this, 0.5f);
                break;
        }
    }

    private void initPictureSelectPop() {
        mPpwSelectPicture = new PpwSelectPicture(this);
        mPpwSelectPicture.setOnItemClickListener(new PpwSelectPicture.OnItemClickListener() {
            @Override
            public void onItemClick(View v) {

                switch (v.getId()) {
                    case R.id.tv_cancel:
                        mPpwSelectPicture.dismiss();
                        break;

                    case R.id.tv_share:
                        mPpwSelectPicture.dismiss();
                        //mTakePhoto.onEnableCompress(mCompressConfig, true);
                        //mTakePhoto.onPickFromGallery();
                        break;

                    case R.id.forward:
                        mPpwSelectPicture.dismiss();
/*                        File file = new File(getExternalCacheDir(), System.currentTimeMillis() + ".png");
                        if (!file.getParentFile().exists())
                            file.getParentFile().mkdirs();
                        Uri imageUri = Uri.fromFile(file);
                        mTakePhoto.onEnableCompress(mCompressConfig, true);
                        mTakePhoto.onPickFromCapture(imageUri);*/
                        break;

                }
            }
        });
    }

}
